/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package loja.gui.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author rsilvasa
 */
public class Email {

    // metodo Copiado do Site http://maafigueiredo.blogspot.com/2009/02/metodo-para-validar-e-mail.html
    public boolean validEmail(String email) {
        System.out.println("Metodo de validacao de email");
        Pattern p = Pattern.compile("^[\\w-]+(\\.[\\w-]+)*@([\\w-]+\\.)+[a-zA-Z]{2,7}$");
        Matcher m = p.matcher(email);
        if (m.find()) {
            System.out.println("O email " + email + " e valido");
            return true;
        } else {
            System.out.println("O E-mail " + email + " é inválido");
            return false;
        }
    }
}
